<div class="modal-header">
    <div class="modal-title">{{_item.id == 0 ? '添加' : '编辑' }}部门</div>
</div>
{{_item|json}}
<form *ngIf="_loaded" #f="ngForm" (ngSubmit)="save()" nz-form [nzType]="'horizontal'">
    <div nz-form-item nz-row class="mb-sm">
        <div nz-form-label nz-col [nzSpan]="8"><label>父级</label></div>
        <div nz-form-control nz-col [nzSpan]="16">
            <nz-cascader name="pid"
                         [nzChangeOnSelect]="true"
                         [nzValueProperty]="'id'"
                         [nzLabelProperty]="'name'"
                         [nzOptions]="_options"
                         [(ngModel)]="_value"
                         (nzChange)="_changeValue($event)">
            </nz-cascader>
        </div>
    </div>
    <div nz-form-item nz-row class="mb-sm">
        <div nz-form-label nz-col [nzSpan]="8"><label>名称</label></div>
        <div nz-form-control nz-col [nzSpan]="16">
            <input nz-input [(ngModel)]="_item.name" name="name" maxlength="20" required/>
        </div>
    </div>
    <div nz-form-item nz-row class="mb-sm">
        <div nz-form-label nz-col [nzSpan]="8"><label>排序</label></div>
        <div nz-form-control nz-col [nzSpan]="16">
            <nz-input-number [(ngModel)]="_item.sort" name="sort" [nzMin]="0" [nzMax]="10000" [nzStep]="1"></nz-input-number>
        </div>
    </div>
    <div nz-form-item nz-row class="mb-sm">
        <div nz-form-label nz-col [nzSpan]="8"><label>是否激活</label></div>
        <div nz-form-control nz-col [nzSpan]="16">
            <nz-switch [(ngModel)]="_item.enable" name="enable"></nz-switch>
        </div>
    </div>
    <div nz-form-item nz-row class="mb-sm">
        <div nz-form-label nz-col [nzSpan]="8"><label>备注</label></div>
        <div nz-form-control nz-col [nzSpan]="16">
            <input nz-input [(ngModel)]="_item.remark" name="remark" maxlength="200"/>
        </div>
    </div>
    <div class="modal-footer">
        <button nz-button type="button" (click)="close()">关闭</button>
        <button nz-button [disabled]="!f.form.valid || !f.form.dirty" [nzType]="'primary'">保存</button>
    </div>
</form>
